package com.mikasa.springboot.example.redismq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import redis.clients.jedis.JedisPubSub;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by sherlock on 17/1/12.
 */

@Service
public class UserMessageListener extends JedisPubSub {

    private static final Logger LOGGER = LoggerFactory.getLogger(UserMessageListener.class);

    private static final ExecutorService threadPool = Executors.newFixedThreadPool(10);

    @Override
    public void onMessage(String channel, String message) {
        LOGGER.info("channel:"+channel+"<message>:"+message);
        //消息处理函数
        handleMessage(channel,message);
    }

    public void handleMessage(String channel, String message){

    }
}
